// 引入请求三级分类列表的ajax请求
import { reqCategoryList } from "@/api"
// 引入设置三级分类列表常量
import {SET_CATEGORYLIST} from "../constant-type"
const state = {
    categoryList: []
}
const mutations = {
    // 设置三级分类列表
    [SET_CATEGORYLIST](state,payload){
        state.categoryList=payload.categoryList
    }
}
const actions = {
    //获取三级分类列表的异步请求
    async getCategoryListAsync({commit}){
        const re = await reqCategoryList()
        commit(SET_CATEGORYLIST,{categoryList:re})
    }
}
const getters = {}

export default {
    namespaced: true,
    state,
    mutations,
    actions,
    getters,
}